package com.xbao.dao;

import com.xbao.model.StuRecordCheck;
import com.xbao.model.StuRecordCheckExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface StuRecordCheckMapper {
    @SelectProvider(type=StuRecordCheckSqlProvider.class, method="countByExample")
    int countByExample(StuRecordCheckExample example);

    @DeleteProvider(type=StuRecordCheckSqlProvider.class, method="deleteByExample")
    int deleteByExample(StuRecordCheckExample example);

    @Delete({
        "delete from stu_record_check",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into stu_record_check (sid, rid, ",
        "orgid, cid, subid, ",
        "status, comments, ",
        "createtime, checktime)",
        "values (#{sid,jdbcType=BIGINT}, #{rid,jdbcType=BIGINT}, ",
        "#{orgid,jdbcType=BIGINT}, #{cid,jdbcType=BIGINT}, #{subid,jdbcType=BIGINT}, ",
        "#{status,jdbcType=INTEGER}, #{comments,jdbcType=VARCHAR}, ",
        "#{createtime,jdbcType=BIGINT}, #{checktime,jdbcType=BIGINT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(StuRecordCheck record);

    @InsertProvider(type=StuRecordCheckSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(StuRecordCheck record);

    @SelectProvider(type=StuRecordCheckSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="rid", property="rid", jdbcType=JdbcType.BIGINT),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT),
        @Result(column="cid", property="cid", jdbcType=JdbcType.BIGINT),
        @Result(column="subid", property="subid", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="comments", property="comments", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="checktime", property="checktime", jdbcType=JdbcType.BIGINT)
    })
    List<StuRecordCheck> selectByExample(StuRecordCheckExample example);

    @Select({
        "select",
        "id, sid, rid, orgid, cid, subid, status, comments, createtime, checktime",
        "from stu_record_check",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="rid", property="rid", jdbcType=JdbcType.BIGINT),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT),
        @Result(column="cid", property="cid", jdbcType=JdbcType.BIGINT),
        @Result(column="subid", property="subid", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="comments", property="comments", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="checktime", property="checktime", jdbcType=JdbcType.BIGINT)
    })
    StuRecordCheck selectByPrimaryKey(Long id);

    @UpdateProvider(type=StuRecordCheckSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") StuRecordCheck record, @Param("example") StuRecordCheckExample example);

    @UpdateProvider(type=StuRecordCheckSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") StuRecordCheck record, @Param("example") StuRecordCheckExample example);

    @UpdateProvider(type=StuRecordCheckSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(StuRecordCheck record);

    @Update({
        "update stu_record_check",
        "set sid = #{sid,jdbcType=BIGINT},",
          "rid = #{rid,jdbcType=BIGINT},",
          "orgid = #{orgid,jdbcType=BIGINT},",
          "cid = #{cid,jdbcType=BIGINT},",
          "subid = #{subid,jdbcType=BIGINT},",
          "status = #{status,jdbcType=INTEGER},",
          "comments = #{comments,jdbcType=VARCHAR},",
          "createtime = #{createtime,jdbcType=BIGINT},",
          "checktime = #{checktime,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(StuRecordCheck record);
}